import { request } from "@/utils/service"
import type { SysUser } from "./type/user"

export const userAllApi = (params: number) => {
  return request<ApiResponseData<SysUser>>({
    url: "admin/user/all",
    method: "get",
    params: {
      model: params
    }
  })
}

export const userAddApi = (data: { adminUser: SysUser }) => {
  return request<ApiResponseData<SysUser>>({
    url: "admin/user/insert",
    method: "post",
    data
  })
}

export const userUpdateApi = (data: { adminUser: SysUser }) => {
  return request<ApiResponseData<SysUser>>({
    url: "admin/user/update",
    method: "post",
    data
  })
}

export const userDelAllByIdApi = (data: string[]) => {
  return request<ApiResponseData<string>>({
    url: "admin/user/del/id",
    method: "post",
    data
  })
}

export const userPageApi = (data: PageParams<{}>) => {
  return request<ApiResponseData<PageResult<SysUser[]>>>({
    url: "admin/user/page",
    method: "post",
    data
  })
}
